#ifndef _CONFIG_H_
#define _CONFIG_H_

#define PROJECT_NAME "tunnel_scan_main_project"
#define PROJECT_VERSION "1.0.0"
#define BUILD_TIMESTAMP "2025-09-29 16:46:28"

#ifdef MAX_ADU_LENGTH
#undef MAX_ADU_LENGTH
#endif

#define MAX_ADU_LENGTH 512
// 485_1  电机
// 485_2  中云振动
// 485_3  角度、灯
// 485_4  维特振动
// 485_5  激光 温湿度

// RS485_5
// "/dev/ttyS1"
// "/dev/gpiochip3"
// 23

// RS485_4
// "/dev/ttyS4"
// "/dev/gpiochip3"
// 24

// RS485_3
// "/dev/ttyS7"
// "/dev/gpiochip3"
// 22

// RS485_2
// "/dev/ttyS9"
// "/dev/gpiochip3"
// 17

// RS485_1
// "/dev/ttyS6"
// "/dev/gpiochip3"
// 16

/****************************************************************************\
 *
 *  设备配置
 *
\****************************************************************************/

#define DEV_ID "tunnel_test_dev_1"
#define TUNNEL_ID "tunnel_0"
#define DEV_TEMP_FILES_PATH "./app_temp_files/"
#define DEV_SOFT_VERSION "1.0.0"
/****************************************************************************\
 *
 *  传感器配置
 *
\****************************************************************************/


#define VS_REA_XX_USE_CONFIG_H
#define VS_REA_XX_NAME ("vs_rea_xx")
#define VS_REA_XX_RS485_PATH ("/dev/ttyS9")
#define VS_REA_XX_RS485_BAUDRATE (921600)
#define VS_REA_XX_RS485_DE_PATH ("/dev/gpiochip3")
#define VS_REA_XX_RS485_DE_PIN (17)
#define VS_REA_XX_RS485_FRAME_TIMEOUT_MS (5)
#define VS_REA_XX_RS485_RECV_LEN (22)

#define VIT_WTVB02_USE_CONFIG_H
#define VIT_WTVB02_NAME ("vit_wtvb02")
#define VIT_WTVB02_RS485_PATH ("/dev/ttyS4")
#define VIT_WTVB02_RS485_BAUDRATE (230400)
#define VIT_WTVB02_RS485_DE_PATH ("/dev/gpiochip3")
#define VIT_WTVB02_RS485_DE_PIN (24)
#define VIT_WTVB02_RS485_FRAME_TIMEOUT_MS (100)
#define VIT_WTVB02_MODBUS_SLAVE_ADDR (0x50)

#define VIT_HWT901_USE_CONFIG_H
#define VIT_HWT901_NAME ("vit_hwt901")
#define VIT_HWT901_RS485_PATH ("/dev/ttyS7")
#define VIT_HWT901_RS485_BAUDRATE (9600)
#define VIT_HWT901_RS485_DE_PATH ("/dev/gpiochip3")
#define VIT_HWT901_RS485_DE_PIN (22)
#define VIT_HWT901_RS485_FRAME_TIMEOUT_MS (500)
#define VIT_HWT901_MODBUS_SLAVE_ADDR (0x51)

#define MYANTENNA_LASER_USE_CONFIG_H
#define MYANTENNA_LASER_NAME ("myantenna_laser")
#define MYANTENNA_LASER_RS485_PATH ("/dev/ttyS1")
#define MYANTENNA_LASER_RS485_BAUDRATE (115200)
#define MYANTENNA_LASER_RS485_DE_PATH ("/dev/gpiochip3")
#define MYANTENNA_LASER_RS485_DE_PIN (23)
#define MYANTENNA_LASER_RS485_FRAME_TIMEOUT_MS (2000)
#define MYANTENNA_LASER_MODBUS_SLAVE_ADDR (0x01)

#define HK_SHT30_USE_CONFIG_H
#define HK_SHT30_NAME ("hk_sht30")
#define HK_SHT30_RS485_PATH ("/dev/ttyS1")
#define HK_SHT30_RS485_BAUDRATE (115200)
#define HK_SHT30_RS485_DE_PATH ("/dev/gpiochip3")
#define HK_SHT30_RS485_DE_PIN (23)
#define HK_SHT30_RS485_FRAME_TIMEOUT_MS (500)
#define HK_SHT30_MODBUS_SLAVE_ADDR (0x10)

/****************************************************************************\
 *
 *  执行器配置
 *
\****************************************************************************/

#define MODBUS_LED_USE_CONFIG_H
#define MODBUS_LED_NAME ("modbus_led")
#define MODBUS_LED_RS485_PATH ("/dev/ttyS1")
#define MODBUS_LED_RS485_BAUDRATE (9600)
#define MODBUS_LED_RS485_DE_PATH ("/dev/gpiochip3")
#define MODBUS_LED_RS485_DE_PIN (23)
#define MODBUS_LED_RS485_FRAME_TIMEOUT_MS (500)
#define MODBUS_LED_MODBUS_SLAVE_ADDR (0x01)

#define LK_MOTOR_USE_CONFIG_H
#define LK_MOTOR_NAME ("lk_motor")
#define LK_MOTOR_ID (0x01)
#define LK_MOTOR_RS485_PATH ("/dev/ttyS6")
#define LK_MOTOR_RS485_BAUDRATE (115200)
#define LK_MOTOR_RS485_DE_PATH ("/dev/gpiochip3")
#define LK_MOTOR_RS485_DE_PIN (16)
#define LK_MOTOR_RS485_FRAME_TIMEOUT_MS (200)
#define LK_MOTOR_RS485_SEND_ADDITONAL_BYTE_TIME (-0.2f)
#define LK_MOTOR_DES_ANGLE_OFFSET (0.2f) // 可视为到位的偏离目标的角度

/****************************************************************************\
 *
 *  应用层配置
 *
\****************************************************************************/

#define YJ_INFLUXDB_USE_CONFIG_H
#define YJ_INFLUXDB_MIN_SEND_NUM (50)
#define YJ_INFLUXDB_MAX_WAIT_TIME (3000) // ms
#define YJ_INFLUXDB_MAX_RETRY_TIME (3)
#define YJ_INFLUXDB_ADDR ("127.0.0.1:8086")
#define YJ_INFLUXDB_TOKEN ("46pTkJc_PIRgbPS4bQ9y95OxhZBE4FzVQ211Rizv-ZRrNscDcLkUyQeivO9wQEp_eEIUab8zQcZs7pC2JUEK4g==")
#define YJ_INFLUXDB_ORG ("tunnel_dev_org")
#define YJ_INFLUXDB_BUCKET ("tunnel_bucket")
#define YJ_INFLUXDB_MAX_TO_MQTT_SIZE (200)

#define YJ_MQTT_USE_CONFIG_H
#define YJ_MQTT_URL ("mqtt://139.9.73.201:1883")
#define YJ_MQTT_CLIENT_ID (DEV_ID)
#define YJ_MQTT_USERNAME ("dev3")
#define YJ_MQTT_PASSWORD ("dev3")
#define YJ_MQTT_QOS (2)
#define YJ_MQTT_PUBLISH_TOPIC_SENSOR_DATA ("sensor_data/" TUNNEL_ID "/" DEV_ID "/" DEV_ID "/")
#define YJ_MQTT_PUBLISH_TOPIC_STATUS ("status/" TUNNEL_ID "/" DEV_ID "/" DEV_ID "/")
#define YJ_MQTT_SUBSCRIBE_TOPIC_CONTROL ("control/" TUNNEL_ID "/" DEV_ID "/" DEV_ID "/")
#define YJ_MQTT_PUBLISH_TOPIC_CONTROL_FEEDBACK ("control/feedback/" TUNNEL_ID "/" DEV_ID "/" DEV_ID "/")

#endif
